-
Notifications
You must be signed in to change notification settings - Fork 8
Add Support for GetAttribute and Indirect Access to Einsum Interpreter #230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
* Uses COO internally * Lookup is currently naive and O(n)
* Get Attribute is a general purpose node that can be used to retreive the coordinate and element arrays from a sparse tensor
* Currently only supports querying the non-zero elements/data array of a sparse tensor and querying the coordinate array (either for all indicies or a specified dimension
* Currently requires the number of input indicies to match the number of dimensions of a tensor
…[B], where B is a 2d array where each row is an index, and each col represents a different dimension for that index
…ort of indirection in ein.Access
…ndle indirect access
…ensions for indirect access, ensuring compatibility with parent indices.
…direct output assignment
…eduction in the einsum interpreter, enhancing tensor evaluation and index handling.
…uction operations, enhancing tensor evaluation and index management. Updated assertions and added context for evaluation, ensuring proper handling of output tensors.
willow-ahrens
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, thanks! My first request: Please rename to GetAttr (like it is in FinchAssembly, FinchNotation). Additionally, please just use e.g. coords3 rather than coords, 3, to keep a uniform interface to attributes in finch-lite. Once you've fixed this I'll take another look.
…preter, raising a NotImplementedError for unsupported operations. This change is temporary, and is simply for the purpose for a PR and version control
…mensions during tensor permutation. Updated test to flatten the result of multiplication for sparse tensors.
…iplication without indirect assignment in einsum functionality.
Implemented multiple test cases for indirect elementwise addition, multiple reads, operations with constants, nested operations, and direct access only. These tests enhance coverage for the einsum functionality, ensuring proper handling of sparse tensors and indirect indexing.
…add extensive tests for various indirect indexing scenarios. This includes double, triple, and mixed direct/indirect indexing cases, ensuring robust handling of sparse tensors and arithmetic operations.
…nd tensor reshaping. Introduced flattening for index evaluations, optimized axis reordering, and ensured compatibility with parent indices. Updated tests to reflect changes in expected behavior for sparse tensor operations.
…o streamline indirect indexing logic. This change simplifies the code and maintains the integrity of index assertions.
…rating ein.Index and indirect access positions. Improved cartesian product computation and reshaping of tensors, ensuring correct handling of index sizes. Updated tests to reflect changes in expected behavior for indirect indexing scenarios.
…Index and indirect access positions. Enhanced cartesian product computation and index size tracking, ensuring accurate evaluation of tensor indices. Updated logic for processing indirect accesses and their dependencies on true indices.
…ng logic. Improved handling of parent indices for both ein.Index and indirect access, optimizing cartesian product computation and index size tracking. Streamlined the process of building index combinations for tensor evaluation.
I renamed Furthermore querying |
…g logic. Consolidated steps for handling unique parent indices and optimized meshgrid creation for index combinations. Enhanced final shape calculation and tensor permutation to ensure accurate evaluation of tensor expressions.
…/finch-tensor/finch-tensor-lite into mw/add-insum-interpreter-support
… indices and other expressions
* Fixed bugs in new implementation for indirect einsum access
* Simplified computation of target_axes, current_idxs, and new_idxs in ein.Access
|
I have greatly implemented the implementation for all cases of ein.Access.
The new implementation is slightly longer than 10 lines/statements (it clocks in at 13 statements), but avoids any meshgrid calls, and does so recursively (like A[B[i], j, C[i]] -> A2[i, j]) Essentially, while an ein.Access has any indirect access indices.
|
shape,elems, andcoordswhich query attributes from sparse tnesorsB[ACoords[k]])B[AcoordsI[k], j])